package test_59;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Text {

	public static void main(String[] args) {
		HashMap<Student,String> hm = new HashMap<>();
        Student s1 = new Student("张三",22);
        Student s2 = new Student("李四",12);
        Student s3 = new Student("王五",33);
        Student s4 = new Student("小二",11);
        hm.put(s1,"江苏");
        hm.put(s2,"北京");
        hm.put(s3,"河南");
        hm.put(s4,"四川");
        System.out.println("====================");
        Set<Student> keys =hm.keySet() ;
        for(Student key:keys){
            String value = hm.get(key) ;
            System.out.println(key+"="+value);
        }

        System.out.println("=====================");
        Set<Map.Entry<Student,String>> entries =  hm.entrySet();
        for(Map.Entry<Student,String> entry: entries){
            Student key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"="+value);
        }
        System.out.println("====================");
        hm.forEach(( student,s) -> System.out.println(student+"="+s));
    }

	

}
